package xyz.xtt.asset.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import lombok.extern.slf4j.Slf4j;
import xyz.xtt.asset.client.response.AssetGroupResponse;
import xyz.xtt.asset.entity.TblAssetGroup;
import xyz.xtt.asset.service.ITblAssetGroupService;
import xyz.xtt.common.objects.DozerUtil;
import xyz.xtt.common.response.ApiResult;

@Slf4j
@RequestMapping("/api/nft/asset")
@RestController
public class GroupController {

	@Autowired
	private ITblAssetGroupService iTblAssetGroupService;

	/**
	 * 某有资产的详情 检查余额
	 * 
	 * @param assetId
	 * @return
	 */
	@GetMapping("/group")
	public ApiResult<AssetGroupResponse> group(@RequestParam("assetId") Long assetId) {
		log.info("/api/nft/asset/group assetId:{}", assetId);
		TblAssetGroup group = iTblAssetGroupService.queryAssetGroup(assetId);
		AssetGroupResponse transfor = DozerUtil.transfor(group, AssetGroupResponse.class);
		return ApiResult.ok(transfor);
	}

}
